//
// Created by fengjl on 2017/4/28.
//
#include <jni.h>
#include <android/log.h>

#include "preinclude/nativecalc.h"

#define LOG_TAG "MyModule"

#define LOGD(LOG_TAG, ...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGV(LOG_TAG, ...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
#define LOGE(LOG_TAG, ...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

extern "C"
JNIEXPORT jfloat JNICALL
Java_com_example_ndksodemo_CalcSub_calcjniadd(JNIEnv *env, jclass type, jint a, jint b) {

    LOGV(LOG_TAG, "my val: %a,%b", a,b);
    return native_calc_add(a,b);
}

extern "C"
JNIEXPORT jfloat JNICALL
Java_com_example_ndksodemo_CalcSub_calcjnisub(JNIEnv *env, jclass type, jint a, jint b) {

    // TODO
    LOGV(LOG_TAG, "my val: %a,%b", a,b);
    return native_calc_sub(a,b);

}

extern "C"
JNIEXPORT jfloat JNICALL
Java_com_example_ndksodemo_CalcSub_calcjnimult(JNIEnv *env, jclass type, jint a, jint b) {

    // TODO
    LOGE(LOG_TAG, "my val: %a,%b", a,b);
    return native_calc_mult(a,b);
}


extern "C"
JNIEXPORT jfloat JNICALL
Java_com_example_ndksodemo_CalcSub_calcjnidivid(JNIEnv *env, jclass type, jint a, jint b) {

    // TODO
    LOGD(LOG_TAG, "my val: %a,%b", a,b);
    return native_calc_divid(a,b);
}